<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改批量订单</title>
<script language="javascript">
    $(document).ready(function(){
        $("#sureOrder").click(function () {
            var param = $('#orderForm').serialize();
            //alert(param);return ;
            $.post("/batchorder/updBatchOrder",{param: param}, function (data) {
                if (data.code) {
                    alert(data.msg);
                    location.reload();
                    return ;
                } else {
                    alert(data.msg);
                    return false;
                }
            }, "json");
        });
    });
    //返回首页
    function returnBack()
    {
        window.location.href="/batchorder/batchOrderList";
    }
    //更改订单状态 1未生产中 3为作废订单
    function del(status){
        if(status==1){
            var message = "是否确认生产?";
            var factory_goods_day = $("#factory_goods_day").val();
            if(!factory_goods_day){
                alert('工厂预期交货日期不能为空');return false;
            }
            var produce_factory = $("#producefactorys").val();
            if(!produce_factory){
                alert("生产工厂必须选择");return false;
            }

        }else if(status==3){
            var message = "是否确认作废?";
        }else if(status==5){
            var message = "是否确认交货?";
        }else if(status==8){
            var message = "是否确认打款?";
        }else if(status==2){
            var message = "是否确认已完成?";
            //已完成 需查询数据，验证是否存在相关裁剪人员和车工人员
//            var obj =    document.getElementsByName('ppid[]');
//            var obj_caijian = document.getElementsByName('search_caijian[]');
//            var obj_workers = document.getElementsByName('search_workers[]');
//            var chk_value =[];
//            var s= "";
//                for (var i=0;i<obj.length;i++)
//                {
//                    if(i == obj.length-1){
//                        if(obj[i].checked) s+=obj[i].value; //如果选中，将value添加到变量s中
//                    }else{
//                        if(obj[i].checked) s+=obj[i].value+','; //如果选中，将value添加到变量s中
//                    }
//                    if(obj_caijian[i].value){
//
//                    }else{
//                        alert("裁剪人员不能为空");return false;
//                    }
//                    if(obj_workers[i].value){
//
//                    }else{
//                        alert("车工人员不能为空");return false;
//                    }
//                }
           // if(s){
                $.post("/batchorder/isExistsWorkders",false,{param:s},function (data) {
                    if (data.code){
                        //alert(data.msg);return false ;
                    }else{
                    }
                }, "json");
                //return false;
//            }else{
//                alert("未知错误!");return ; //默认所有选中状态，并且无法更改
//            }
        }else if(status==7){
            var message = "是否确认公司验收?";
        }else if(status==6){
            var produce_factory = $("#producefactorys").val();
            var accepter = $("#accepter").val();
            //alert(accepter);return false;
            if(produce_factory&&accepter){
                var message = "是否确认工厂验货完成?";
                //验证裁剪工人与车工人员是否已经选择
                    var obj =    document.getElementsByName('ppid[]');
                    var obj_caijian = document.getElementsByName('search_caijian[]');
                    var obj_workers = document.getElementsByName('search_workers[]');
                    var obj_num = document.getElementsByName('product_num[]');
                    var chk_value =[];
                    var s= "";
                    var caij = "";
                    var worker = "";
                    var num = "";
                    for (var i=0;i<obj.length;i++)
                    {
                        if(i == obj.length-1){
                            if(obj[i].checked) s+=obj[i].value; //如果选中，将value添加到变量s中
                        }else{
                            if(obj[i].checked) s+=obj[i].value+','; //如果选中，将value添加到变量s中
                        }
                        num+=$("#upd_num_"+obj[i].value).val()+',';
                        if(obj_caijian[i].value){
                             caij+=obj_caijian[i].value+','; //如果选中，将value添加到变量s中
                        }else{
                           // alert("裁剪人员不能为空");return false;  暂时不做任何判断了2017/6/3
                            caij+=obj_caijian[i].value+','; //如果选中，将value添加到变量s中
                        }
                        if(obj_workers[i].value){
                            worker+=obj_workers[i].value+','; //如果选中，将value添加到变量s中
                        }else{
                           // alert("车工人员不能为空");return false; 暂时不做任何判断了2017/6/3
                            worker+=obj_workers[i].value+','; //如果选中，将value添加到变量s中
                        }
                    }
                    //alert(num);return false;
                    if(s){
                        //$.post("/batchorder/isExistsWorkders",false,{param:s},function (data) {
                        //    if (data.code){
                          //      //alert(data.msg);return false ;
                         //   }else{
                         //   }
                      // }, "json");
                        //return false;
                    }else{
                        alert("未知错误!");return ; //默认所有选中状态，并且无法更改
                    }
                //验证裁剪工人与车工人员结束
                var fdel=window.confirm(message);
                if (fdel){
                    var order_id = $("#order_id").val();
                    //alert(num);return false;
                    var url = "/batchorder/ajaxbutton?op=delBatchOrder&order_id="+order_id+"&status="+status+"&accepter="+accepter+"&produce_factory="+produce_factory+"&param="+s+"&caij="+caij+"&work="+worker+"&num="+num;
                    //alert(url);return ;
                    location.href = url;
                    return ;
                }else{
                    return false;
                }
            }else{
                alert('请选择生产工厂并填写验收人!');return ;
            }

        }else{
            return false;
        }
        var fdel=window.confirm(message);
        if (fdel){
            var order_id = $("#order_id").val();
            if(status==1){
                var url = "/batchorder/ajaxbutton?op=delBatchOrder&order_id="+order_id+"&status="+status+"&factory_goods_day="+factory_goods_day;
            }else{
                var url = "/batchorder/ajaxbutton?op=delBatchOrder&order_id="+order_id+"&status="+status;
            }
            //alert(url);return ;
            location.href = url;
        }else{
            return false;
        }
    }
    function checkDecimal(obj) {
        //var decimalReg=/^\d{0,9}\)?$/; //只能输入数字
        var decimalReg = /^\d+(?=\.{0,1}\d+$|$)/; //可以输入数字或小数点
        if(obj.value!=""&&decimalReg.test(obj.value)){
        }else {
            if (obj.value != "") {
                //alert('非法值！请重新输入！');return ;
                obj.value = 0
            }
        }
    }
    function doSubmitMsg(order_id){
        if(confirm("工厂结束该批次的生产。本次生产数量作为最后数量?")){
            $.post(
                    "/batchorder/ajaxbutton",
                    {"op":"endFlag","order_id":order_id},
                    function (data){
                        if(data.code){
                            location.reload();
                        }else {
                            alert(data.msg);return false;
                        }
                    }, "json");
        }

    }
    //单个工厂验货完成
    function factoryCheck(id,status,order_id) {
        if(!confirm('你确认工厂验货各项数据无误?')){
            return false;
        }
        var caijian = $("#caijian_"+id).val();
        var workers = $("#workers_"+id).val();
        /**  这里不做任何判断了，不论他选不选
        if($("#caijian_"+id).val()){
            var caijian = $("#caijian_"+id).val();
        }else{
            alert("请选择裁剪人员!");return false;
        }
        if($("#workers_"+id).val()){
            var workers = $("#workers_"+id).val();
        }else{
            alert("请选择车工人员!");return false;
        }
        **/
        var stock_num = $("#upd_num_"+id).val();
        var price = $("#upd_price_"+id).val();
        var memo = $("#upd_memo_"+id).val();
        //生产工厂
        var produce_factory = $("#produce_factory_"+id).val();

        $.post(
                "/batchorder/ajaxbutton",
                {"op":"factorycheck","id":id,"caijian": caijian,"workers":workers,"memo":memo,"price":price,"stock_num":stock_num,"status":status,"order_id":order_id,"produce_factory":produce_factory},
                function (data){
                    if(data.code){
                        //alert(data.msg);
                        location.reload();
                    }else {
                        alert(data.msg);return false;
                    }
             }, "json");
    }
function showRemark(id) {
    $.post(
            "/batchorder/ajaxbutton",
            {"op":"getOneBatchData","id":id},
            function (data){
                //alert(data.batch_id);return false;
                $("#orders_id").val(data.batchorder_id);
                $("#goods_sku").val(data.goods_code);
                $("#goods_sub_sku").val(data.goods_sku);
                $("#specifications").val(data.product_type);
                //$("#goods_num").val(data.product_num);
                $("#fIDs").val(data.factory_id);
                $("#batch_id").val(data.batch_id);

            }, "json");
    $('#showmabangorder').modal('show');
}
    function atmangban()
    {
        var insttime = $("#insttime").val();
        if(insttime=="")
        {
            alert("请输入日期！");
            return;
        }
        var order_id = $("#orders_id").val();
        //alert(order_id);return false;
        if(order_id=="")
        {
            alert("请输入订单号！");
            return;
        }
        var goods_sku = $("#goods_sku").val();
        if(goods_sku=="")
        {
            alert("请输入SKU！");
            return;
        }
        var specifications = $("#specifications").val();
        if(specifications=="")
        {
            alert("请输入尺码！");
            return;
        }
        var goods_num = $("#goods_num").val();
        if(goods_num=="")
        {
            alert("请输入数量！");
            return;
        }
        var fID = $("#fIDs").val();
        if(fID=="")
        {
            alert("请选择工厂！");
            return;
        }
        var remarks = $("#remarks").val();
        if(remarks==""){
            alert("请输入备注");
            return ;
        }
        var batch_id = $("#batch_id").val();
        var goods_sub_sku = $("#goods_sub_sku").val();
        remarks = remarks+"("+insttime+","+goods_num+")";
        //var insttime = $("#insttime").val();
        //var order_id = $("#orders_id").val();
       // var goods_sku = $("#goods_sku").val();
        //var specifications = $("#specifications").val();
        //var goods_num = $("#goods_num").val();

        $.post("/batchorder/ajaxbutton", {"op": "savescanorder","insttime":insttime,"order_id":order_id,"goods_sku":goods_sku,"specifications":specifications,"goods_num":goods_num,"fID":fID,"remarks":remarks,"batch_id":batch_id,"goods_sub_sku":goods_sub_sku},
                function(data){
                    if(data==200)
                    {
                        window.location.reload();
                        //window.location.href = "/factory/scanorder";
                    }else{
                        alert(data);return false;
                    }
                },"text");
    }
function delMemo(id,memo) {
    if(!id){
        alert("无效参数");return false;
    }
    var memo = $.trim(memo);
    var msg = "你确定删除"+"【"+memo+"】"+"这条备注吗?";
    var message = confirm(msg);
    if(message){
        $.post("/batchorder/ajaxbutton", {"op": "delMemo","memo":memo,"id":id},
                function(data){
                    if(data==200)
                    {
                        alert("删除成功!");
                        window.location.reload();
                    }else{
                        alert("错误");
                        location.reload();
                    }
                },"text");
    }
}
    function changeFactoryWage(produce_factory) {
            var order_id = $("#order_id").val();
            $.post("/batchorder/ajaxbutton", {"op": "updProduceFactory","id":produce_factory,"order_id":order_id},
                    function(data){
                        if(data.code==200)
                        {
                            if(data.wages){
                                $("#price").val(data.wages);
                            }
                            //window.location.reload();
                        }else{
                            alert("错误");
                            location.reload();
                        }
                    },"json");
        
    }
</script>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
    <div class="centercontent">
        <div class="pageheader notab">
            <h1 class="pagetitle">修改批量订单</h1>
        </div>
        <!--pageheader-->
        <div id="contentwrapper" class="contentwrapper">
            <div id="basicform" class="subcontent">
                <form class="stdform stdform2"  id="orderForm" method="post" action="/batchorder/updBatchOrder" enctype="multipart/form-data" >
                    <table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="showtable">
                        <tbody>
                        <tr>
                            <td class="head1">所属工厂</td>
                            <td class="head0" colspan="4">
                                    {{foreach from=$factorys item=res key=key}}
                                       {{if $res.id eq $batchorder.factory_id}}{{$res.name}} {{/if}} 
                                    {{/foreach}}
                            </td>
                            </td>
                        </tr>
                         <tr>
                            <td class="head1">状态</td>
                            <td class="head0" colspan="4">
                                {{if $batchorder.status eq 1}}
                                生产中
                                {{elseif $batchorder.status eq 2}}
                                已完成
                                {{elseif $batchorder.status eq 3}}
                                已作废
                                {{elseif $batchorder.status eq 5}}
                                交货中
                                {{elseif $batchorder.status eq 6}}
                                工厂验货已完成
                                {{elseif $batchorder.status eq 7}}
                                公司验收已完成
                                {{elseif $batchorder.status eq 8}}
                                打款中
                                {{else}}
                                新订单
                                {{/if}}
                            </td>
                            </td>
                        </tr>
                        
                           
                         <tr>
                            <td class="head1">商品编号</td>
                            <td class="head0" colspan="4">{{$batchorder.goods_code}}</td>
                         
                        </tr>
                        <tr>
                            <td class="head1">工价</td>
                            <td class="head0" colspan="4"><input type="text" onblur='checkDecimal(this)' id= "price" name="price" class="width100" value="{{$batchorder.price}}"></td>
                        </tr>
                        <tr {{if $batchorder.status ==4}} style="display:none{{/if}}">
                            <td class="head1">生产日期<input type="hidden" id = "order_id" name="order_id" class="width100" value="{{$order_id}}" ></td>
                            <td class="head0" colspan="4">{{$batchorder.produce_date}}</td>
                        </tr>
                        <tr>
                            <td class="head1">客户希望交货日期</td>
                            <td class="head0" colspan="4" ><input type="text" name="customer_day" class="width100" value="{{$batchorder.goods_date}}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker"></td>
                           
                        </tr>
                        <tr>
                            <td class="head1">工厂预期交货日期</td>
                            <td class="head0" colspan="4" ><input type="text" name="factory_goods_day" id="factory_goods_day" class="width100" value="{{$batchorder.factory_goods_day}}" onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker"></td>

                        </tr>
                        <tr {{if $batchorder.status ==4 || $batchorder.status ==1}} style="display:none{{/if}}">
                            <td class="head1">实际交货日期</td>
                            <td class="head0" colspan="4">{{$batchorder.real_goods_date}}</td>
                        </tr>
                        <tr {{if $batchorder.status ==4 || $batchorder.status ==1 || $batchorder.status ==5|| $batchorder.status ==6|| $batchorder.status ==7}} style="display:none{{/if}} ">
                            <td class="head1">打款日期</td>
                            <td class="head0" colspan="4"><input type="text" name="remit_day" class="width100" value="{{$batchorder.remit_date}}" disabled></td>
                        </tr>
                        <tr {{if $batchorder.status ==4 || $batchorder.status ==1}} style="display:{{/if}}">
                            <td class="head1">生产工厂</td>
                            <td colspan="4" class="head0">
                                <select class="selection select2_group" name="producefactorys" id="producefactorys" onchange="changeFactoryWage(this.value);">
                                    <option value="">请选择</option>
                                    {{foreach from=$producefactorys item=rs key=key}}
                                    <option value="{{$rs.id}}" {{if $rs.id eq $batchorder.produce_factory}} selected {{/if}} >{{$rs.name}}</option>
                                    {{/foreach}}
                                </select></td>
                            </td>
                        </tr>
                        <tr>
                            <td class="head1">验收人</td>
                            <td class="head0"><input type="text" name="accepter" id="accepter" class="width100" value="{{$batchorder.accepter}}" ></td>
                            <td class="head1"></td>
                            <td class="head0"></td>
                            <td class="head1"></td>
                        </tr>
                        <tr id="beizhu">
                            <td class="head1">备注信息</td>
                            <td class="head0" colspan="4">
                                <textarea name="memo" cols="10" rows="6">{{$batchorder.memo}}</textarea>
                            </td>
                        </tr>
                        <tr>
                        <td class="head1" colspan="4">
                            {{if $batchorder.status ==2}}
                            {{elseif $batchorder.status eq 3}}
                            {{else}}
                                    <button type="button" id ="sureOrder" class="btn btn-primary">确认保存</button>
                            {{/if}}
                            {{if $batchorder.status==1}}
                            			{{if $userclassid==12 || $userclassid==13 || $userclassid==16}}
                                    <button type="button" id ="produce" class="btn btn-primary" onClick="del(5)" >确认交货</button>
                                    	{{/if}}
                            {{elseif $batchorder.status eq 5}}
                                    <!-- 在商品列表都验证完成时，自动完成
                            		{{if $userclassid==12 || $userclassid==13 || $userclassid==16}}
                                      <button type="button" id ="produce" class="btn btn-primary" onClick="del(6)" >工厂验货完成</button>
                              		{{/if}}
                              		-->
                            {{elseif $batchorder.status eq 6}}


                                {{if $userclassid==12 || $userclassid==13 || $userclassid==16}}
                                {{else}}
                                    <button type="button" id ="produce" class="btn btn-primary" onClick="del(7)" >公司验收完成</button>
                                {{/if}}

                                            <!--  先注销，防止以后又改回来
                                            {*{if $batchorder.property eq 1}*}
                                                    <button type="button" id ="produce" class="btn btn-primary" onClick="del(8)" >确认打款</button>
                                            {*{elseif $batchorder.property eq 2}*}
                                                    <button type="button" id ="produce" class="btn btn-primary" onClick="del(7)" >公司验收完成</button>
                                            {*{else}*}
                                                    <button type="button" id ="produce" class="btn btn-primary" onClick="del(8)" >确认打款</button>
                                            {*{/if}*}
                                            -->
                            {{elseif $batchorder.status eq 8}}
                               
                                    <button type="button" id ="have_finish" class="btn btn-primary" onClick="del(2)" >已完成</button>
                               
                            {{elseif $batchorder.status eq 7}}
                                {{if $userclassid==12 || $userclassid==13 || $userclassid==16}}
                            <button type="button" id ="sure_remit" class="btn btn-primary" onClick="del(8)" >确认打款</button>
                                {{else}}
                                <button type="button" id ="sure_remit" class="btn btn-primary" onClick="del(8)" >确认打款</button>
                                {{/if}}

                              
                            {{elseif $batchorder.status eq 4}}
                               
                               	{{if $userclassid==12 || $userclassid==13 || $userclassid==16 || $managers}}
                                    <button type="button" id ="produce" class="btn btn-primary" onClick="del(1)">开始生产</button>
                                {{/if}}
                             
                                    <button type="button" id ="abandon" class="btn btn-primary" onClick="del(3)">作废</button>
                              
                            {{/if}}
                            
                            <!--
                            <td class="head0">
                                <button type="button" id ="produce" class="btn btn-primary" onclick="del(1)">开始生产</button>
                            </td>-->
                           		
                                <button type="button" id ="returnback" class="btn btn-primary" onClick="returnBack()">返回</button>
                                &nbsp;&nbsp;&nbsp;
                            {{if $batchorder.end_flag eq 1}}
                                <span style="color:red;">
                                    工厂结束该批次的生产。本次生产数量作为最后数量
                                </span>
                            {{/if}}
                            </td>
                           <td style="float:right;">
                               {{if $batchorder.status ==5 || $batchorder.status == 6}}
                                   {{if $userclassid==12 || $userclassid==13 || $userclassid==16}}
                                       {{if $batchorder.end_flag eq 0}}
                                       <button type="button"  class="btn btn-primary" onClick="doSubmitMsg({{$batchorder.order_id}})" >工厂生产结束</button>
                                       {{/if}}
                                   {{/if}}
                               {{/if}}
                           </td>
                        </tr>
                        </tbody>
                            </form>
                    </table>
                    <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                        <form class="stdform stdform2"  id="orderListForm" method="post" action="/batchorder/updBatchOrderList" enctype="multipart/form-data" >
                        <tbody>
                        <tr style="background-color: #b6cad2;">
                            <td class="head0">
                             <!--  <a onClick="allSelect('ppid[]')">全选</a>-->
                                全选
                            </td>
                            <td class="head1">商品编号</td>
                            <td class="head1">关联sku</td>
                            <td class="head0">图片</td>
                            <td class="head1">商品名称</td>
                            <td class="head0">产品型号</td>
                            <td class="head1">生产数量</td>
                           <!-- {*{if $batchorder.status ==5||$batchorder.status ==2}*}-->
                                <td class="head0">裁剪</td>
                                <td class="head1">车工</td>
                          <!--  {*{/if}*}-->
                            <td class="head1">生产工厂</td>
                            <td class="head0">备注</td>
                            <!--
                            <td class="head0" style="width:50px;">工价</td>
                            -->
                         <!-- {*{if $batchorder.status ==5}*}-->
                                <td class="head0" style="width: 120px;">操作</td>
                          <!-- {*{/if}*}-->
                        </tr>
                        {{foreach from=$batchorder_list item=res key=key}}
                        <tr>
                            <td class="head0"><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$res.id}}" readonly checked="checked" onClick="return false;"/></td>
                            <td class="head1"><a href="/product/productlist?other={{$res.goods_code}}">{{$res.goods_code}}</a></td>
                            <td class="head1"><a href="/product/productlist?other={{$res.goods_sku}}">{{$res.goods_sku}}</a></td>
                            <!--暂时本地测试地址固定-->
                            <td class="head0"><img src="http://192.168.1.66/{{$res.thumb_url}}" width="50"></td>
                            <td class="head1" style="width: 100px;">
                                <!--
                                <span style="width: 30px;overflow:hidden;white-space:nowrap; text-overflow:ellipsis;">
                                    {{$res.goods_name}}
                                </span>
                                -->
                                <span>
                                    {{$res.goods_name}}
                                </span>
                            </td>
                            <td class="head0">
                                {{$res.product_type}}
                            {{if $batchorder.status ==4}}
                                <input type="text" size="20" name="protypename[]" value=""  placeholder="格式：M,亚洲,男" />
                            {{/if}}
                            </td>
                            <td class="head1">
                                {{$res.product_num}}<br/>
                                {{if $batchorder.status ==4||$batchorder.status ==1}}
                                   <input type="text" name="upd_num[]" id="upd_num_{{$res.id}}" value="{{$res.product_num}}" style="width:100px" placeholder="数量" onblur='checkDecimal(this)'>
                                {{else}}
                               {{/if}}
                               
                               {{if $batchorder.status ==5}}
                                   <input type="text" name="upd_num[]" id="upd_num_{{$res.id}}" value="{{$res.product_num}}" style="width:100px" placeholder="数量" onblur='checkDecimal(this)'>
                                <!--
                                <input type="text" name="upd_num[]" id="upd_num_{{$res.id}}" value="{{$res.savenum}}" style="width:100px" placeholder="不改就留空" onblur='checkDecimal(this)'>
                                -->
                                {{/if}}
                            </td>
                          <!--  {*{if $batchorder.status ==5||$batchorder.status ==2}*}-->
                                <td class="head0">
                                    <select class="selectCss2" name="search_caijian[]" id="caijian_{{$res.id}}">
                                        <option value="">请选择</option>
                                        {{foreach from=$arr_caijian item=lis key=key}}
                                            <option value="{{$lis.id}}" {{if $res.caijian_id eq $lis.id}}selected{{/if}}>{{$lis.name}}</option>
                                        {{/foreach}}
                                    </select>
                                </td>
                                <td class="head1">
                                    <select class="selectCss2" name="search_workers[]" id="workers_{{$res.id}}">
                                        <option value="">请选择</option>
                                        {{foreach from=$arr_workers item=li key=key}}
                                        <option value="{{$li.id}}" {{if $res.workers_id eq $li.id}}selected{{/if}}> {{$li.name}} </option>
                                        {{/foreach}}
                                    </select>
                                </td>
                          <!--  {*{/if}*}-->
                            <td class="head0">
                                <select class="selectCss2" name="produce_factory[]" id="produce_factory_{{$res.id}}">
                                    <option value="">请选择</option>
                                    {{foreach from=$producefactorys item=rs key=key}}
                                        <option value="{{$rs.id}}" {{if $rs.id eq $res.produceFactoryId}} selected {{/if}} >{{$rs.name}}</option>
                                    {{/foreach}}
                                </select></td>
                            </td>
                            <td class="head0">
                                {{foreach from=$res.memo item=result key=key}}
                                    {{if $result}}

                                        <a href="javascript:void(0)" onClick="delMemo({{$res.id}},this.text)" style="color:blue;" title="点击可删除该备注">

                                            {{$result}}

                                        </a>

                                    {{/if}}
                                    <br/>
                                {{/foreach}}

                                {{if $batchorder.status ==4}}
                                    <input type="text" name="upd_memo[]" id="upd_memo_{{$res.id}}" value="" placeholder="请输入备注内容" onClick="showRemark({{$res.id}})">
                                {{else}}
                                    <input type="text" name="upd_memo[]" id="upd_memo_{{$res.id}}" value="" placeholder="请输入备注内容" onClick="showRemark({{$res.id}})">
                                {{/if}}

                            </td>
                            <!--
                            <td class="head0">
                                {{$res.batchorder_price}}<br/>
                                <!--
                                <input type="text" name="upd_price[]" id="upd_price_{{$res.id}}" value="{{$res.batchorder_price}}" placeholder="" onBlur="checkDecimal(this)">
                                -->
                           <!-- </td> -->

                            <!-- {*{if $batchorder.status ==5}*}-->
                             <!--
                                <td class="head0">
                                    <button class="btn btn-primary"><a href="javascript:void(0)" onclick="factoryCheck({{$res.id}})">工厂验收完成</a> </button>
                                </td>
                              -->
                            <td class="head0">
                                {{if $userclassid==12 || $userclassid==13 || $userclassid==16}}
                                    {{if $res.order_status == 6}}
                                            <span style="color:blue">工厂验货已完成</span>
                                        <!-- <span style="color:blue">工厂验货已完成</span> -->
                                      <!--  <button type="button" class="btn btn-primary" onClick="factoryCheck({{$res.id}},7,{{$res.batchorder_id}})" style="background-color:#00A2D4;border:#00A2D4; ">公司验收完成</button>-->
                                     {{else}}
                                        {{if $batchorder.status ==5}}
                                                {{if $msg_flag eq 1}}
                                                    <button type="button" class="btn btn-primary" onClick="factoryCheck({{$res.id}},6,{{$res.batchorder_id}})" >工厂验货</button>
                                                {{else}}
                                                    <button type="button" class="btn btn-primary" onClick="factoryCheck({{$res.id}},6,{{$res.batchorder_id}})" >工厂验货</button>
                                                {{/if}}
                                        {{else}}
                                               <!-- 暂不能验货操作-->
                                                <span>
                                                    <!--工厂未验货-->
                                                </span>
                                         {{/if}}
                                    {{/if}}

                                {{/if}}
                            </td>
                          <!-- {*{/if}*} -->
                        </tr>
                        {{/foreach}}
                        {{if $batchorder.status ==2}}
                        {{elseif $batchorder.status eq 3}}
                        {{else}}
                        <tr>
                            <td colspan="12">
                                {{if $batchorder.status ==4||$batchorder.status ==1}}
                                     <button type="submit" id = "saveOrderList" class="btn btn-primary" >确认保存</button>
                                 {{else}}
                                {{if $managers || in_array('229',$showpower)}}
                                        {{if $batchorder.status==2}}
                                         {{else}}
                                    <button type="submit" id = "saveOrderList" class="btn btn-primary" >确认保存</button>
                                         {{/if}}
                                    <!--<button type="button" id ="produce" class="btn btn-primary" onClick="del(6)">工厂验货完成</button><span style="color:red;">（备注：所有工厂验货完成,点击该按钮）</span>-->
                                    {{/if}}
                                {{/if}}
                               <!-- {*{if $batchorder.status ==5}*}-->
                               <!--     {*{if $userclassid==12 || $userclassid==13 || $userclassid==10}*}-->
                                    <!-- <button type="submit" id = "saveOrderList" class="btn btn-primary" >确认保存</button>-->
                                    <!--<button type="button" id ="produce" class="btn btn-primary" onClick="del(6)">工厂验货完成</button><span style="color:red;">（备注：所有工厂验货完成,点击该按钮）</span>-->
                              <!--      {*{/if}*}-->
                             <!--   {*{/if}*} -->
                            </td>
                        </tr>
                        {{/if}}
                        </tbody>
                        </form>
                    </table>
                    <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                        <thead>
                        <tr>
                            <td>修改时间</td>
                            <td>订单编号</td>
                            <td>操作详情</td>
                            <td>操作人员</td>
                        </tr>
                        </thead>
                        <tbody>
                        {{foreach from=$logs item=rs key=key}}
                            <tr>
                                <td>{{$rs.createtime}}</td>
                                <td>{{$rs.order_id}}</td>
                                <td>{{$rs.details}}</td>
                                <td>{{$rs.username}}</td>
                            </tr>
                        {{/foreach}}
                        </tbody>
                    </table>
                <br />
            </div>
            <!--subcontent-->

            <!--subcontent-->

        </div>
        <!--contentwrapper-->

    </div>
    <!-- centercontent -->

</div>
<!--bodywrapper-->

<!-- 模态框（Modal）添加支出 -->
<form  method="post">
    <input type="hidden" name="editid" id="editid">
    <div class="modal fade" id="showmabangorder" tabindex="-1" role="dialog" aria-labelledby="sshowmabangorder" aria-hidden="true">
        <div class="modal-dialog" style="width:740px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">× </button>
                    <h4 class="modal-title" id="sshowmabangorder"> 添加备注 </h4>
                </div>
                <div class="modal-body">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td align="right">工厂清单日期：</td>
                            <td align="left"><input type="text" name="insttime" id="insttime" style="width:100px;line-height:0.4;"  onClick="WdatePicker()" >
                                <font color="#FF0000">(*必填项)</font></td>
                        </tr>
                        <tr>
                            <td align="right">本次入库数量： </td>
                            <td align="left">
                                <input type="hidden" name="orders_id" id="orders_id" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" />
                                <input type="hidden" name="goods_sku" id="goods_sku" value="" maxlength="200" style="width:100px;line-height:0.4;" size=10  />
                                <input type="hidden" name="goods_sub_sku" id="goods_sub_sku" value="" maxlength="200" style="width:100px;line-height:0.4;" size=10  />
                                <input type="hidden" name="specifications" id="specifications" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" />
                                <input type="hidden" name="fIDs" id="fIDs" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" />
                                <input type="hidden" name="batch_id" id="batch_id" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" />
                                <input type="text" name="goods_num" id="goods_num" value="" maxlength="200" style="width:100px;line-height:0.4;" class="small_input" /> <font color="#FF0000">(*必填项,本次工厂送货数量)</font>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">备注： </td>
                            <td align="left"><input type="text" name="remarks" id="remarks" value="" maxlength="400" style="width:200px;line-height:0.4;" class="small_input" /> <font color="#FF0000">(*必填项)</font></td>
                        </tr>
                        <tr>
                    </table>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default"
                                data-dismiss="modal"> 关闭 </button>
                        <button type="button" class="btn btn-primary"  onclick="atmangban()"> 提交 </button>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
        </div>
    </div>
    <!-- /.modal -->
</form>
</body>
</html>